<?php

class Zend_View_Helper_Mensaje extends Zend_View_Helper_Abstract {

    private $_types = array(
        Zend_Controller_Action_Helper_Mensaje::ERROR,
        Zend_Controller_Action_Helper_Mensaje::WARNING,
        Zend_Controller_Action_Helper_Mensaje::NOTICE,
        Zend_Controller_Action_Helper_Mensaje::SUCCESS
    );



    public function mensaje() {
        $flashMessenger = Zend_Controller_Action_HelperBroker::getStaticHelper('Mensaje');
        $html = '';
        foreach ($this->_types as $type) {
            $messages = $flashMessenger->getMessages($type);
            if (!$messages) {
                $messages = $flashMessenger->getCurrentMessages($type);
            }
            if ($messages) {
 
                $html .= '<div class="' .strtoupper($type)  . '">';
                $html .= '<ul>';
                foreach ($messages as $message) {
                    $html.= '<li>';
                    $html.= $message->message;
                    $html.= '</li>';
                }
                $html .= '</ul>';
                $html .= '</div>';
            }
        }
       
        return $html;
    }

}

?>
